	<!-- BEGIN PAGE -->
	<div class="page-content">
         <!-- BEGIN PAGE CONTAINER-->        
         <div class="container-fluid">
            <!-- BEGIN PAGE HEADER-->
			<div class="row-fluid">
				<div class="span12"> 
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->			
					<h3 class="page-title">
						Menu <small>pengaturan menu</small>
					</h3>
					<ul class="breadcrumb">
						<li>
							<i class="icon-cogs"></i>
							Pengaturan		
							<i class="icon-angle-right"></i>
						</li>
						<li>Menu</li>	
					</ul>
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
            </div>
            <!-- END PAGE HEADER-->
            <!-- BEGIN PAGE CONTENT-->          
            <div class="row-fluid">
               <div class="span12">
                  <!-- BEGIN SAMPLE TABLE PORTLET-->
                  <div class="portlet box blue">
                     <div class="portlet-title">
                        <div class="caption"><i class="icon-cogs"></i>List Menu</div>
						<div class="tools">
                           <a href="<?php echo base_url()?>menu/form" class="btn blue"><i class="icon-plus"></i> Tambah</a>
                        </div>
                     </div>
                     <div class="portlet-body flip-scroll">
                        <table id="table-menu" class="table table-bordered table-striped table-condensed flip-content table-hover">
							<thead class="flip-content">
								<tr>
									<th align="center">Name</th>
									<th align="center">Alias</th>
									<th align="center">Parent</th>
									<th align="center">Access</th>
									<th align="center">Order</th>
									<th align="center">Link</th>
									<th align="center">Action</th>
								</tr>
							</thead>
                           <tbody>
                              <?php
								function menu_list($menu,$root="0"){
									
									$loop=1;
									foreach($menu as $row){
										$id="";
										foreach($row as $key=>$parent){
										
											if($key == 'data'){
												$id = ($root != "0"?"$root.$loop":$loop);
												
												echo "<tr data-tt-id=\"$id\" ".($root != "0"?"data-tt-parent-id=\"$root\"":"").">";
													echo "<td><i class=\"$parent[icon]\"></i> $parent[name]</td>";
													echo "<td>$parent[alias]</td>";
													echo "<td align='center'>$parent[parent]</td>";
													echo "<td align='center'>$parent[id_access]</td>";
													echo "<td align='center'>$parent[order]</td>";
													echo "<td>$parent[link]</td>";
													echo "<td align='center'>
													<a href=\"".base_url()."menu/form/".encode($parent['menu_id'])."\" title=\"Edit Menu\" class=\"btn mini green\"><i class=\"icon-edit\"></i> Edit</a>
													<a href=\"".base_url()."menu/delete/".encode($parent['menu_id'])."\" title=\"Remove Menu\" class=\"btn mini red\" onClick=\"return confirm('Menu akan dihapus. Lanjutkan ?')\"><i class=\"icon-trash\"></i> Hapus</a>
													</td>";
													echo "</tr >";
											}else{
												if(count($parent) > 0){
													menu_list($parent,$id);
												}
											}
										}
										$loop++;
									}
								}
								menu_list($menu);
								?>
                           </tbody>
                       </table>
                     </div>
                  </div>
                  <!-- END SAMPLE TABLE PORTLET-->
               </div>              
            </div>
           
            <!-- END PAGE CONTENT-->
         </div>
         <!-- END PAGE CONTAINER-->
    </div>
    <!-- END PAGE -->
	<script>
		$(document).ready(function(){
			$("#table-menu").treetable({ expandable: true });
			$("#table-menu").treetable("expandAll");
		});
	</script>
	<?php $this->load->view('template/messages'); ?>